//
//  QueryCarefulVC.m
//  CJRailTransport
//
//  Created by Hank on 2018/1/16.
//  Copyright © 2018年 amplity. All rights reserved.
//

#import "QueryCarefulVC.h"
#import "QueryCarefulCell.h"
#import "QueryDetailVC.h"
#import "UIView+Expand.h"

@interface QueryCarefulVC ()

@end

@implementation QueryCarefulVC

- (void)viewDidLoad {
    [super viewDidLoad];
    // 设置导航栏
    [self setNavC];
    // 设置界面属性
    [self setViewAttribute];
    // 注册Cell
    [self registerCells];
    // 设置圆角
    [self setRadius];
}

#pragma mark - 导航栏
- (void)setNavC
{
    self.title = @"查询";
    // 设置导航栏颜色
    BasicNavigationController *nVC = (BasicNavigationController *)self.navigationController;
    nVC.themeColor = [UIColor whiteColor];
    nVC.tintColor = [UIColor darkGrayColor];
}

// 设置界面属性
- (void)setViewAttribute
{
    self.view.backgroundColor = [UIColor whiteColor];
}

// 注册Cell
- (void)registerCells
{
    UINib *nib = [UINib nibWithNibName:[QueryCarefulCell reuseIdentifier] bundle:nil];
    [_myTableView registerNib:nib forCellReuseIdentifier:[QueryCarefulCell reuseIdentifier]];
}

#pragma mark - Radius
// 设置圆角
- (void)setRadius
{
    // 设置圆角
    [self.searchBg radiusView:5 backgroundColor:[UIColor clearColor] borderWidth:0.5 borderColor:DefaultRadiusGray];
}

#pragma mark - textFieldDelegate
- (BOOL)textFieldShouldReturn:(UITextField *)textField
{
    QueryDetailVC *queryDetailVC = [[QueryDetailVC alloc]init];
    queryDetailVC.vin = self.searchTF.text;
    [self.navigationController pushViewController:queryDetailVC animated:YES];
    return YES;
}

#pragma mark - TableViewDataSource
- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView
{
    return 1;
}

- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{
    return 1;
}

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
    QueryCarefulCell *cell = [tableView dequeueReusableCellWithIdentifier:[QueryCarefulCell reuseIdentifier] forIndexPath:indexPath];
    cell.indexPath = indexPath;
    return cell;
}

#pragma mark - TableViewDelegate
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
    
}

- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath
{
    return 226;
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

@end
